<?php

//getParameter("category")==null &&
$displayed_categories=false;
if (getParameter("cas")==null){


        $parent="NULL";

if (getParameter("category")!=null) $parent=getObjByKey("ammn_category","id","category",getParameter("category"));




function printsubcategories($parent){
    global $portalId;
$op=" = ";
if ($parent=="NULL") $op="is";
$SQL="SELECT
ammn_category.id,
ammn_category.Lib as lib,
ammn_category.category,
ammn_category.parentId
FROM `ammn_category`
WHERE parentId $op $parent AND  ammn_category.portalId = $portalId Order by orderCmpnt asc";
//echo $SQL;
Portal_log($SQL);
$rs=ew_LoadRecordset($SQL);

if ($rs && $rs->RecordCount()>0) {
$displayed_categories=true;
$count=$rs->RecordCount();
//echo $count;
$item_per_column=2;
//echo $item_per_column;
    ?><ul><?php
$i=0;
 while ( !$rs->EOF)  { 
 	

?>
		<li><a href="/cascliniques/<?php echo $rs->fields["category"]; ?>.html"><?php echo $rs->fields["lib"];   ?></a></li>
		<?php printsubcategories($rs->fields["id"]); ?>
<?php
			
		  $rs->MoveNext();    
		  }

        ?></ul><?php

    }

}

        printsubcategories($parent);
} ?>